-
Notifications
You must be signed in to change notification settings - Fork 359
Pinv numpy backend #918
base: master
Are you sure you want to change the base?
Pinv numpy backend #918
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add pinv
to all other backends, or raise a NotImplementedError
,
and add tests for each function. Thanks!
Returns: | ||
tensor: The pseudo inverse of tensor. | ||
""" | ||
return np.linalg.pinv(tensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should use the tensorflow version here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi.
In a StackOverflow article someone has mentioned that the Tensorflow version doesn't work for complex matrices and that's why I went with the Numpy Version.
So shall I still use the Tensorflow version only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, please use tensorflow. The point here is to use backend-native operations.
This is done with respect to issue: #844
pinv
function is added totensornetwork/backends/tensorflow/numpy_backend.py
The
pinv
function has been referred from https://numpy.org/doc/stable/reference/generated/numpy.linalg.pinv.htmlPlease do have a look and let me know if should make any other change.
Thank you.